    //导航高亮
    function highlight_subnav(url){
        $('.treeview-menu').find('a[href="'+url+'"]').closest('li').addClass('active').parent().parent().addClass('active');
    }
    //失败跳转
    function complete(data) {
        if (data.code == 1) {
            layer.alert(data.msg, {icon: 6}, function (index) {
                layer.close(index);
                window.location.href = data.url;
            });
        } else {
            layer.alert(data.msg, {icon: 5}, function (index) {
                layer.close(index);
                window.location.href = data.url;
            });
            return false;
        }
    }
    function CheckAll(form) {
        for (var i = 0; i < form.elements.length; i++) {
            var e = form.elements[i];
            if (e.Name != 'chkAll' && e.disabled == false) {
                e.checked = form.chkAll.checked;
            }
        }
    }
    /* 通用含验证码表单不带检查操作，失败不跳转 */
    $(function () {
        $('.ajaxForm3').ajaxForm({
            success: complete2, // 这是提交后的方法
            dataType: 'json'
        });
    });
    //失败不跳转
    function complete2(data) {
        if (data.code == 1) {
            layer.msg(data.msg, {icon: 6}, function (index) {
                layer.close(index);
                window.location.href = data.url;
            });
        } else {
            layer.alert(data.msg, {icon: 5}, function (index) {
                layer.close(index);
            });
        }
    }
    /* 激活状态操作 */
    $(function () {
        $('body').on('click','.active-btn',function () {
            var $url = this.href,
                val = $(this).data('id'),
                $btn=$(this);
            $.post($url, {x: val}, function (data) {
                if (data.code==1) {
                    if (data.msg == '关闭') {
                        $btn.children('span').html(data.msg).attr('title','关闭').removeClass('label-success').addClass('label-danger');
                        return false;
                    } else {
                        $btn.children('span').html(data.msg).attr('title','开启').removeClass('label-danger').addClass('label-success');
                        return false;
                    }
                } else {
                    layer.alert(data.msg, {icon: 5});
                }
            }, "json");
            return false;
        });
    });